<template>
	<view>
		<bg-video></bg-video>
		<cu-custom bgColor="bg-main" :isBack="true">
			<block class="text-white" slot="content">老师列表</block>
		</cu-custom>
		<view>
			
			<view class="">
				<view class="" v-for="(jl,index) in ajiaolians" :key="index">
					<jl-item :jl="jl"></jl-item>
				</view>
				<view v-if="this.ajiaolians.length < pageInfo.total" class="padding flex flex-direction">
					<button class="cu-btn bg-main lg" @tap="loadMore">显示更多</button>
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		data: function() {
			return {
				searchKey: "",
				astoreid: "",
				ajiaolians: [],
				mds: this.location.mds,
				pageInfo: {
					current: 1,
					total: 0,
					size: 12
				},
				lxmap: this.location.lxmap,
			}
		},
		onShareAppMessage: function(){
			return {
				title: this.store.state.title,
				path: '/pages/first?id='+this.store.state.client.clientid
			}
		},
		onLoad: function(option) {
			if (option.mdid) {
				this.astoreid = option.mdid;
			}
			if (option.aroomid) {
				this.aroomid = option.aroomid;
			}
			this.search();
		},
		methods: {
			navigateToJlDetail(jlid) {
				uni.navigateTo({
					url: "/pages/cxy/jl/jlxx?jlid=" + jlid
				})
			},
			loadJL: function() {
				this.api("/jl/page").send({
						astoreid: this.astoreid,
						aroomid: this.aroomid,
						current: this.pageInfo.current,
						size: this.pageInfo.size,
						searchKey: this.searchKey
				}).then(res => {
					for (let index in res.ajiaolians.records) {
						let record = res.ajiaolians.records[index];
						record.lx = JSON.parse(record.lx);
						this.ajiaolians.push(record);
					}
					this.pageInfo.total = res.ajiaolians.total;
				})
			},
			search: function() {
				this.ajiaolians = [];
				this.pageInfo.current = 1;
				this.loadJL();
			},
			loadMore: function() {
				this.pageInfo.current++;
				this.loadJL();
			}
		}
	}
</script>

<style>
</style>